#ifndef _DEV_SDRAM_H_
#define _DEV_SDRAM_H_

#include "data_type.h"

/* SDRAM配置参数 */
#define SDRAM_MODEREG_BURST_LENGTH_1             ((uint16_t) 0x0000)
#define SDRAM_MODEREG_BURST_LENGTH_2             ((uint16_t) 0x0001)
#define SDRAM_MODEREG_BURST_LENGTH_4             ((uint16_t) 0x0002)
#define SDRAM_MODEREG_BURST_LENGTH_8             ((uint16_t) 0x0004)
#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL      ((uint16_t) 0x0000)
#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED     ((uint16_t) 0x0008)
#define SDRAM_MODEREG_CAS_LATENCY_2              ((uint16_t) 0x0020)
#define SDRAM_MODEREG_CAS_LATENCY_3              ((uint16_t) 0x0030)
#define SDRAM_MODEREG_OPERATING_MODE_STANDARD    ((uint16_t) 0x0000)
#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t) 0x0000)
#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE     ((uint16_t) 0x0200)

/* SDRAM起始地址 */
#define DEV_SDRAM_BANK_ADDR                      ((uint32_t) 0xC0000000)

enum
{
    DEV_SDRAM_BANK1 = 0,
    DEV_SDRAM_BANK2,
    DEV_SDRAM_BANK1_2,
};

void dev_sdram_init(void);

RET_STATUS dev_sdram_write(uint8_t *pbuf, uint32_t write_addr, uint32_t len);
RET_STATUS dev_sdram_read(uint8_t *pbuf, uint32_t read_addr, uint32_t len);

void dev_sdram_test(void);


#endif
